Skip to content

fix(cli): return failure for invalid commands - #327

Open
caiopizzol wants to merge 1 commit into
amp-labs:mainfrom
caiopizzol:fix/command-exit-status
Open

fix(cli): return failure for invalid commands#327
caiopizzol wants to merge 1 commit into
amp-labs:mainfrom
caiopizzol:fix/command-exit-status

Conversation

@caiopizzol

Copy link
Copy Markdown
Contributor

What

Exit with status 1 when Cobra rejects a command or its arguments. Add a subprocess test for the process status.

Why

The CLI printed an error for invalid commands but returned status 0. Scripts and agents could treat a rejected command as successful.

Verification

  • go build ./...
  • go test ./...
  • go vet ./...
  • golangci-lint v2.9.0
  • Ran list:installations against the production Asana integration: the valid command returned both installations and status 0
  • Ran the same command without its required integration ID: status changed from 0 before the fix to 1 after it

Expose Cobra execution failures through the process status so scripts and agents do not treat rejected commands as successful.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant